﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test_Conllision : MonoBehaviour
{
	private void OnDrawGizmos()
	{
		//Gizmos.DrawCube(this.transform.position, new Vector3(3f, 3f, 3f));
	}
	private void Update()
	{
		bool d = IsDangrous(this.gameObject, new Vector2(this.transform.position.x, this.transform.position.y), new Vector2(3f, 3f));
		Debug.Log(d);
	}

	protected virtual bool IsDangrous(UnityEngine.GameObject @object, Vector2 center, Vector2 size)
	{
		
		Collider2D[] collider2D = Physics2D.OverlapBoxAll(center, size, 0);
		if (collider2D.Length <= 1)
			return false;
		else
		{

			for (int i = 0; i < collider2D.Length; i++)
			{
				if (collider2D[i].gameObject.tag == "Player" && collider2D[i].gameObject != @object)
				{
					return true;
				}
			}
		}
		// Physics.OverlapBox(transform.position, size, Quaternion.identity)
		return false;
	}

	protected virtual bool IsDangrous(GameObject gameObject,Vector3 center, Vector3 size)
	{
		Physics.OverlapBox(center, size);



		return false;
	}
}
